<HTML><HEAD><TITLE>sbds_initialise(+VarMatrix, ++NDims, +SymPreds, ++FixPred, +Options)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(fd_sbds)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>sbds_initialise(+VarMatrix, ++NDims, +SymPreds, ++FixPred, +Options)</H1>
Initialises the data needed for sbds
<DL>
<DT><EM>VarMatrix</EM></DT>
<DD>Matrix of Search Variables
</DD>
<DT><EM>NDims</EM></DT>
<DD>The Dimenson of VarMatrix
</DD>
<DT><EM>SymPreds</EM></DT>
<DD>List of symmetry predicates
</DD>
<DT><EM>FixPred</EM></DT>
<DD>Predicate to assign a variable to a value
</DD>
<DT><EM>Options</EM></DT>
<DD>List of Options to use during search
</DD>
</DL>
<H2>Description</H2>
<H4><I> Symmetry Predicates </I></H4>
	VarMatrix, is the matrix of variables, which are searched over to allocate 		values to.
	<br>
	<br>
	NDims is the dimenson of VarMatrix
	<br>
	<br>
	The symmetry predicates should transform a variable and value to their 
	symmetrical equivalent. The last four arguments of these predicates should 
	therefore be the original variable, the original value (which are input) then 		the symmetrical variable and the symmetrical value (which are output). Before 		these parameters you can give any other parameters which are useful in your 		implementation i.e. the matrix of variables. So my symmetry predicate might be:
	symmetry_predicate(Matrix, Var, Val, SymVar, SymVal).
	<br>
	<br>
	When creating the list of symmetry predicates (the parameter given to 			sbds_initalise), you only need to specify the parameters that you have added. 		So for the above predicate, the entry to the list would 				be: symmetry_predicate(Matrix).
	This is shown below in the N-Queens model.
	<br>
	<br>
	The FixPred is the predicate which will fix and exclude a variable to a value 		at decision points in the search tree, it must have three parameters the first 		two will be the variable and the value, and the third will be a boolean which 		specifies whether the variable is being fixed or excluded i.e. is this 			constraint true or false. #= / 3, is usually used for thse purposes.
	<br>
	<br>
	The Options list, will be a list of options which can be used during search 		i.e. whether SBDS should be used at every node of the search tree. None of 		these options are implemented as yet, so it should always be an empty list.
	<br><H4><I> What SBDS initialise does: </I></H4>
	Called before search commences. Sets up the symmetries to indicate that 		
	they are all unbroken initally and initalises all the variables etc. that will 		be utilised during search.
<H3>Modules</H3>
This predicate is sensitive to its module context (tool predicate, see @/2).
<H3>Exceptions</H3>
<DL>
<DT><EM>(abort) </EM>
<DD>Options is not an empty list
</DL>
<H2>Examples</H2>
<H3>Nqueens using a boolean encoding on a 2 dimensonal array</H3>
	<H4><I> The Symmetry Predicates for Nqueens Symmetries:</I></H4>
	<dl>
	<dt>r90(Matrix, N, [X,Y], Value, SymVar, SymValue) :-</dt>
    		<dd>SymVar is Matrix[Y, N + 1 - X],</dd>
    		<dd>SymValue is Value.</dd>
	</dl>
	<dl>
	<dt>r180(Matrix, N, [X,Y], Value, SymVar, SymValue) :-</dt>
    		<dd>SymVar is Matrix[N + 1 - X, N + 1 - Y],</dd>
    		<dd>SymValue is Value.</dd>
	</dl>
	<dl>
	<dt>r270(Matrix, N, [X,Y], Value, SymVar, SymValue) :-</dt>
    		<dd>SymVar is Matrix[N + 1 - Y, X],</dd>
    		<dd>SymValue is Value.</dd>
	</dl>	
	<dl>
	<dt>rx(Matrix, N, [X,Y], Value, SymVar, SymValue) :-</dt>
    		<dd>SymVar is Matrix[N + 1 - X, Y],</dd>
    		<dd>SymValue is Value.</dd>
	</dl>
	<dl>
	<dt>ry(Matrix, N, [X,Y], Value, SymVar, SymValue) :-</dt>
    		<dd>SymVar is Matrix[X, N + 1 - Y],</dd>
    		<dd>SymValue is Value.</dd>
	</dl>
	<dl>
	<dt>rd1(Matrix, _N, [X,Y], Value, SymVar, SymValue) :-</dt>
    		<dd>SymVar is Matrix[Y, X],</dd>
    		<dd>SymValue is Value.</dd>
	</dl>
	<dl>
	<dt>rd2(Matrix, N, [X,Y], Value, SymVar, SymValue) :-</dt>
    		<dd>SymVar is Matrix[N + 1 - Y, N + 1 - X],</dd>
    		<dd>SymValue is Value.</dd>
	</dl>
	<H4><I> Then to initialise SBDS</I></H4>
	<dt>%The list of symmetry predicates,</dt>
	<dt>Syms = [</dt>
		<dd>r90(Matrix, N),</dd>
		<dd>r180(Matrix, N),</dd>
		<dd>r270(Matrix, N),</dd>
		<dd>rx(Matrix, N),</dd>
		<dd>ry(Matrix, N),</dd>
		<dd>rd1(Matrix, N),</dd>
		<dd>rd2(Matrix, N)</dd>
	<dt>],</dt>
	<dt>%the call to sbds_initalise,</dt>
	<dt>sbds_initialise(Matrix, 2, Syms, #=, []).</dt></dl> 
<H2>See Also</H2>
<A HREF="../../lib/fd_sbds/sbds_initialise-4.html">sbds_initialise / 4</A>, <A HREF="../../lib/fd_sbds/sbds_try-2.html">sbds_try / 2</A>
</BODY></HTML>
